package com.software.car.common.enums;

/**
 * @Description
 * 异常枚举
 *
 * @Author 魔法はまだ解けない
 * @Date 2021/1/17
 */
public enum ResultEnum {

    SUCCESS(200, "请求成功"),
    FAIL(500, "服务器发生未知异常"),
    //    抛出异常
    REQUEST_METHOD_EXCEPTION(4001, "HTTP请求方法不正确"),
    REQUEST_PARAMETER_EXCEPTION(4002, "缺少HTTP请求参数或HTTP请求参数不正确"),
    OSS_EXCEPTION(4003, "url不正确或者不存在该文件"),

    USER_NOT_FIND(5001,"用户不存在"),
    LOGIN_EXCEPTION(5002,"账号密码错误"),
    TOKEN_EXCEPTION(5003,"token过期或token不正确"),
    TOKEN_LENGTH_EXCEPTION(5004,"token不存在"),
    LOGIN_ERROR(5005,"登陆异常，可能是无权访问、token不存/过期在或用户不存在"),
    PARAMS_NOT_FOUND(5006,"未传递正确参数"),
    INSERT_USER_FAIL(5007,"插入用户失败"),
    INSERT_USER_SUCCESS(5008,"添加用户成功！"),
    INSERT_FAIL(5009,"插入数据失败"),
    ACCOUNT_HAS_EXIT(5010,"账号已经存在"),
    UPDATE_ERROR(5011,"修改失败"),
    ADMINISTER_UPDATE_ERROR(5012,"个人应该到个人界面修改"),
    PARAMS_ERROR(5006,"未传递正确参数"),
    DATA_TOO_LONG(5013,"参数数据太长，请检查"),
    FILE_UPLOAD(5014,"文件上传失败"),
    FILE_NAME_OUT_OF_LENGTH(5015,"文件名太长"),
    OLD_PASSWORD_ERROR(5017,"旧密码错误"),
    PASSWORD_CHANGE_ERROR(5018,"请勿修改超级管理员密码，修改请联系程序员"),
    PASSWORD_LENGTH_ERROR(5019,"密码长度不符合"),
    ACCOUNT_LENGTH_ERROR(5020,"账号长度不符合"),
    PARAMS_NOT_ALLOW(5021,"参数不符合要求"),

    EXCEPTION(5000,"未知异常，请查看后端日志");


    /**
     * 异常状态码
     */
    private int code;
    /**
     * 异常状态信息
     */
    private String err;

    /**
     * 异常码枚举构造器
     *
     * @param err  异常状态信息
     */
    ResultEnum(int code, String err) {
        this.code=code;
        this.err = err;
    }

    public int getCode() {
        return code;
    }
    public String getMsg() {
        return err;
    }

}
